package com.baize.channel.game.view;

import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;
import android.widget.EditText;

public class GameWebView extends WebView {
    public Context mContext;
    public EditText mFocusDistraction;

    public GameWebView(Context context) {
        super(context);
        init(context);
    }

    public GameWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public GameWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    public void init(Context context) {
        if (!isInEditMode()) {
            this.mContext = context;
            this.mFocusDistraction = new EditText(context);
            this.mFocusDistraction.setBackgroundResource(android.R.color.transparent);
            addView(this.mFocusDistraction);
            this.mFocusDistraction.getLayoutParams().width = 1;
            this.mFocusDistraction.getLayoutParams().height = 1;
        }
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        invalidate();
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    @Override
    public boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
        return false;
    }

    @Override
    public void scrollTo(int x, int y) {
        super.scrollTo(0, 0);
    }
}
